INT 21H - CLASSES OF FUNCTIONS CHARACTER INPUT - 01H 03H 06H 07H 08H 0AH 0BH 0CH CHARACTER OUTPUT - 02H 04H 05H 06H 09H DIRECTORY OPERATIONS - 39H 3AH 3BH 47H DISK CONTROL - 0DH 0EH 19H 1BH 1CH 2EH 36H 54H 58H DISK TRANSFER AREA ADDRESS - 1AH 2FH DYNAMIC MEMORY ALLOCATION - 48H 49H 4AH 58H FILE OPERATIONS - 0FH 10H 11H 12H 13H 16H 17H 23H 3CH 3DH 3EH 41H 43H 45H 46H 4EH 4FH 56H 57H 5AH 5BH MISCELLANEOUS SYSTEM FUNCTIONS - 25H 26H 29H 30H 33H 35H 38H 44H 4BH 4DH 59H 62H NETWORK FUNCTIONS - 44H 5EH 5FH PROGRAM TERMINATION - 00H 31H 4CH RECORD OPERATIONS - 14H 15H 21H 22H 24H 27H 28H 3FH 40H 42H 5CH RESERVED (UNDOCUMENTED) FUNCTIONS - 18H 1DH 1EH 1FH 20H 32H 34H 37H 50H 51H 52H 53H 55H 5DH 60H 61H SYSTEM DATE AND TIME - 2AH 2BH 2CH 2DH OTHER DOS INTERRUPTS - 20H 24H 25H 26H 27H 28H COMMON BIOS INTERRUPTS - 10H 11H 12H 13H 14H 16H 17H 1AH USE ARROW KEYS TO SELECT CLASS AND HIT TO EXIT$ 000 000"000000 z #000000Ow 00#00$% FUNCTION (HEX) DESCRIPTION --------------- ------------------------------------------------------------$ 01 CHARACTER INPUT WITH ECHO 03 AUXILIARY INPUT 06 DIRECT CONSOLE I/O 07 UNFILTERED CHARACTER INPUT - NO ECHO 08 CHARACTER INPUT - NO ECHO 0A BUFFERED INPUT 0B GET INPUT STATUS 0C RESET INPUT BUFFER AND GET INPUT USE ARROW KEYS TO SELECT AND HIT - PRIOR MENU TO EXIT$ 0 00PPPPPPPP)-,147T9H=> 02 CHARACTER OUTPUT 04 AUXILIARY OUTPUT 05 PRINTER OUTPUT 06 DIRECT CONSOLE I/O 09 OUTPUT CHARACTER STRING USE ARROW KEYS TO SELECT AND HIT - PRIOR MENU TO EXIT$ 000PPPPP+5./,1"A 39 CREATE SUBDIRECTORY 3A DELETE SUBDIRECTORY 3B SET CURRENT DIRECTORY 47 GET CURRENT DIRECTORY USE ARROW KEYS TO SELECT AND HIT - PRIOR MENU TO EXIT$ 000PPPPG0KNQ 0D DISK RESET 0E SET DEFAULT DISK DRIVE 19 GET DEFAULT DISK DRIVE 1B GET ALLOCATION INFORMATION FOR DEFAULT DRIVE 1C GET ALLOCATION INFORMATION FOR SPECIFIED DRIVE 2E SET VERIFY FLAG 36 GET FREE DISK SPACE 54 GET VERIFY FLAG USE ARROW KEYS TO SELECT AND HIT -PRIOR MENU TO EXIT$ 0 00PPPPPPPPTQVtXY]`bee00 1A SET DISK TRANSFER ADDRESS 2F GET DISK TRANSFER ADDRESS USE ARROW KEYS TO SELECT AND HIT - PRIOR MENU TO EXIT$ 000PPfLi 48 ALLOCATE MEMORY 49 RELEASE MEMORY 4A MODIFY MEMORY ALLOCATION 58 GET OR SET ALLOCATION STRATEGY USE ARROW KEYS TO SELECT AND HIT - PRIOR MENU TO EXIT$ 000PPPPnjvnnqt 0F OPEN FILE - FCB 10 CLOSE FILE - FCB 11 SEARCH FOR FIRST MATCH - FCB 12 SEARCH FOR NEXT MATCH - FCB 13 DELETE FILE - FCB 16 CREATE OR TRUNCATE FILE - FCB 17 RENAME FILE - FCB 23 GET FILE SIZE - FCB 3C CREATE OR TRUNCATE FILE - ASCIIZ 3D OPEN FILE - ASCIIZ 3E CLOSE FILE - HANDLE 41 DELETE FILE - ASCIIZ 43 GET OR SET FILE ATTRIBUTES - ASCIIZ 45 DUPLICATE HANDLE - HANDLE 46 FORCE DUPLICATE OF HANDLE - HANDLE 4E SEARCH FOR FIRST MATCH - ASCIIZ 4F SEARCH FOR NEXT MATCH - ASCIIZ 56 RENAME FILE - ASCIIZ 57 GET OR SET FILE DATE AND TIME - HANDLE 5A CREATE TEMPORARY FILE 5B CREATE NEW FILE USE ARROW KEYS TO SELECT AND HIT - PRIOR MENU TO EXIT$ 000PPPPPPPPPPPPPPPPPPPPPHy|O~1wۈc mڤ/ N>0 25 SET INTERRUPT VECTOR 26 CREATE PROGRAM SEGMENT PREFIX 29 PARSE FILENAME 30 GET MS-DOS VERSION NUMBER 33 GET OR SET CTL-BREAK FLAG 35 GET INTERRUPT VECTOR 38 GET OR SET COUNTRY 44 DEVICE DRIVER CONTROL 4B EXECUTE PROGRAM 4D GET RETURN CODE 59 GET EXTENDED ERROR INFORMATION 62 GET PROGRAM SEGMENT PREFIX ADDRESS USE ARROW KEYS TO SELECT AND HIT - PRIOR MENU TO EXIT$ 1 00PPPPPPPPPPPPV1 & v*%'b0000 44 DEVICE DRIVER CONTROL (IOCTL) 5E GET MACHINE NAME/PRINTER INFORMATION 5F ASSIGN LIST ENTRY USE ARROW KEYS TO SELECT AND HIT - PRIOR MENU TO EXIT$ 100PPP& i4\? 00 PROGRAM TERMINATE 31 PROGRAM TERMINATE AND STAY RESIDENT 4C PROGRAM TERMINATE WITH RETURN CODE USE ARROW KEYS TO SELECT AND HIT - PRIOR MENU TO EXIT$ 100PPPESWT 14 SEQUENTIAL READ - FCB 15 SEQUENTIAL WRITE - FCB 21 RANDOM READ - FCB 22 RANDOM WRITE - FCB 24 SET RANDOM RECORD NUMBER - FCB 27 RANDOM BLOCK READ - FCB 28 RANDOM BLOCK WRITE - FCB 3F READ FILE OR DEVICE - HANDLE 40 WRITE TO FILE OR DEVICE - HANDLE 42 MOVE FILE POINTER - HANDLE 5C RECORD LOCKING - HANDLE USE ARROW KEYS TO SELECT AND HIT - PRIOR MENU TO EXIT$ 1 00PPPPPPPPPPPZ{]`lcUfhk=p\tx~00 18 RESERVED 1D RESERVED 1E RESERVED 1F RESERVED 20 RESERVED 32 RESERVED 34 RESERVED* 37 RESERVED* 50 RESERVED* 51 RESERVED* 52 RESERVED* 53 RESERVED 55 RESERVED* 5D RESERVED 60 RESERVED 61 RESERVED USE ARROW KEYS TO SELECT AND HIT - PRIOR MENU TO EXIT$ 100PPPPPPPPPPPPPPPPʚ - PRIOR MENU TO EXIT$ 100PPPP2MN*PQ INT 20H PROGRAM TERMINATE INT 25H ABSOLUTE DISK READ INT 26H ABSOLUTE DISK WRITE INT 27H TERMINATE AND STAY RESIDENT INT 28H INTERNAL VECTOR (Undocumented) USE ARROW KEYS TO SELECT AND HIT - PRIOR MENU TO EXIT$ 100PPPPP}U-R0 INT 10H VIDEO SERVICES - Functions 00H - 08H INT 10H VIDEO SERVICES - Functions 09H - 0EH INT 10H VIDEO SERVICES - Functions 0FH - 1CH INT 11H EQUIPMENT DETERMINATION INT 12H MEMORY SIZE DETERMINATION INT 13H DISK SERVICES INT 14H SERIAL PORT SERVICES INT 16H KEYBOARD SERVICES INT 17H PRINTER SERVICES INT 1AH TIME OF DAY SERVICES USE ARROW KEYS TO SELECT AND HIT - PRIOR MENU TO EXIT$ 2 00PPPPPPPPPP l!|%&54BHyN FUNCTION: 00H PROGRAM TERMINATE DESCRIPTION: One of several methods to terminate a program; flushes all file buffers to disk; restores exit addresses; other methods of terminating a program are preferred CALL: AH = 0 CS = PSP segment RETURNS: Nothing SEE ALSO: Functions 4CH and 31H$ FUNCTION: 01H CHARACTER INPUT WITH ECHO DESCRIPTION: Waits for a character from the standard input (keyboard) and then echoes it to the standard output (display); can be redirected; recognizes Ctl-C CALL: AH = 01H RETURNS: AL = 8 bit ASCII code for character input If AL = 0, it signifies that extended ASCII character input; call function again to get 8 bit scan code SEE ALSO: Functions 06H, 07H, 3FH and 08H$ FUNCTION: 02H CHARACTER OUTPUT DESCRIPTION: Output a character to standard output (display); output can be redirected; recognizes Ctl-C. CALL: AH = 02H DL = 8 bit ASCII code to be output RETURNS: Nothing SEE ALSO: Function 40H$ FUNCTION: 03H AUXILIARY INPUT DESCRIPTION: Waits for a character from the standard auxiliary (serial port - COM1); recognizes Ctl-C; can be redirected. CALL: AH = 3 RETURNS: AL = 8 bit ASCII code input SEE ALSO: Function 3FH and ROM BIOS INT 14H$ FUNCTION: 04H AUXILIARY OUTPUT DESCRIPTION: Output a character to the standard auxiliary (serial port - COM1); recognizes Ctl-C; can be directed. CALL: AH = 04H DL = 8 bit ASCII code of character to be output RETURNS: Nothing SEE ALSO: Function 40H and ROM BIOS INT 14H$ FUNCTION: 05H PRINTER OUTPUT DESCRIPTION: Sends a character to the standard list device (PRN or LPT1); recognizes Ctl-C; waits until device is ready to accept character; can be redirected. CALL: AH = 05H DL = 8 bit ASCII code of character to be output RETURNS: Nothing SEE ALSO: Function 40H or ROM BIOS INT 17H$ FUNCTION: 06H DIRECT CONSOLE I/O DESCRIPTION: Reads a character from the standard input (keyboard) without echoing or outputs one to the standard output (display); does not recognize Ctl-C, Ctl-Break or any other control codes - all are passed on to the calling program. CALL: AH = 06H DL = function requested 0ffh if input requested 8 bit ASCII character code if output requested RETURNS: If output requested, nothing If input requested and character received Zero Flag = clear AL = 8 bit ASCII code of character received If input requested and character not received Zero Flag = Set$ SEE ALSO: For input - 01H, 07H, 08H, 0AH, 3FH For output - 02H, 09H, 40H$ FUNCTION: 07H UNFILTERED CHARACTER INPUT WITHOUT ECHO DESCRIPTION: Waits for and reads a character from the standard input (keyboard), does not copy it to standard output (display); can be redirected; does not recognize Ctl-C or Ctl-Break; CALL: AH = 07H RETURNS: AL = 8 bit ASCII code for character input If AL = 0, it signifies that extended ASCII character input; call function again to get 8 bit scan code SEE ALSO: Function 3FH$ FUNCTION: 08H CHARACTER INPUT WITHOUT ECHO DESCRIPTION: Waits for and reads a character from the standard input (keyboard), does not copy it to standard output (display); can be redirected; recognizes Ctl-C and Ctl-Break; CALL: AH = 08H RETURNS: AL = 8 bit ASCII code for character input If AL = 0, it signifies that extended ASCII character input; call function again to get 8 bit scan code SEE ALSO: Function 01H, 06H, 0AH, 0CH, 3FH$ FUNCTION: 0AH BUFFERED INPUT DESCRIPTION: Reads a string of bytes from the standard input (keyboard), including the ending ASCII carriage return, and places them in a user defined buffer; echoes each character to the standard output (display); recognizes Ctl-C and Ctl-Break; can be redirected. CALL: AH = 0AH DS:DX = Segment:Offset of Buffer First byte of buffer specifies the maximum number of bytes the buffer can hold (0ffh maximum) and must be supplied by user; function will only add characters to the buffer until the next to last position; it will ignore additional characters until a carriage return is entered. RETURNS: Length of the entry is placed, by the function, into the second byte of the buffer (DX + 1);$ FUNCTION: 0BH GET INPUT STATUS DESCRIPTION: Checks whether a character is available from the standard input (keyboard);can be redirected; recognizes Ctl-C and Ctl-Break CALL: AH = 0BH RETURNS: AL = 0 no character available = 0FFH character available; must be read by a call to the proper function.$ FUNCTION: 0CH RESET INPUT BUFFER AND GET INPUT DESCRIPTION: Clears the standard input (keyboard) buffer and invokes one of the character input functions. CALL: AH = 0CH AL = number of character input function to be invoked after clearing input buffer; must be 01H, 06H, 07H 08H or 0AH. If AL = 0AH, then DS:DX = Segment:Offset of Buffer RETURNS: If AL = 0AH, nothing returned If AL = any other function, AL = 8 bit ASCII code of input$ FUNCTION: 09H OUTPUT A CHARACTER STRING DESCRIPTION: Sends a character string to the standard output (display); string must be terminated with a 'dollar sign' (ASCII 24); can be redirected. CALL: AH = 09H DS:DX = Segment:Offset of string to be displayed RETURNS: Nothing SEE ALSO: Function 40H$ FUNCTION: 59H GET EXTENDED ERROR INFORMATION DESCRIPTION: Obtains information after unsuccessful INT 21H call SET: AH = 50H BX = 0 RETURNS: AX = extended error code (0-no error) 1-invalid function 2-file not found 3-path not found 4-too many open files 5-access denied 6-invalid handle 7-MCB destroyed 8-insufficient memory 9-invalid MCB 0AH-invalid environment 0BH-invalid format 0CH-invalid access code 0DH-invalid data 0EH-RESERVED 0FH-invalid drive 10H-remove current directory 11H-not same device 12H-no more files 13H-write protected 14H-unknown unit 15H-drive not ready 16H-unknown command 17H-CRC error 18H-bad request structure 19H-seek error 1AH-unknown medium type 1BH-sector not found 1CH-printer out of paper 1DH-write fault 1EH-read fault 20H-sharing violation 21H-lock violation 22H-disk change invalid 23H-FCB unavailable 24-4FH-RESERVED 50H-file already exists 51H-RESERVED 52H-cannot make directory 53H-fail on INT 24H BH = error class BL = recommended action CH = error locus$ FUNCTION: 39H CREATE SUBDIRECTORY DESCRIPTION: Creates a subdirectory using the specified drive and path; specified drive/path string must be in ASCIIZ format; that is, terminated with an ASCII '0'; call will fail if any element of the path does not exist, if a subdirectory of the same name already exists or if the parent directory is the root directory and is full. CALL: AH = 39H DS:DX = Segment:Offset of ASCIIZ path specification RETURNS: If successful: Carry Flag = Clear If unsuccessful: Carry Flag = Set AX = Error Code 3 - if path not found 5 - if access denied$ FUNCTION: 3AH DELETE SUBDIRECTORY DESCRIPTION: Removes a subdirectory from the specified drive and path; specified drive/path string must be in ASCIIZ format; that is, terminated with an ASCII '0'; call will fail if any element of the path does not exist, if the specified subdirectory is the current directory or if the specified subdirectory still contains files. CALL: AH = 3AH DS:DX = Segment:Offset of ASCIIZ path specification RETURNS: If successful: Carry Flag = Clear If unsuccessful: Carry Flag = Set AX = Error Code 3 - if path not found 5 - if access denied 6 - if current directory 16 - if current directory$ FUNCTION: 3BH SET CURRENT DIRECTORY DESCRIPTION: Sets the current or default directory using the specified drive and path; specified drive/path string must be in ASCIIZ format; that is, terminated with an ASCII '0'; call will fail if any element of the path does not exist; CALL: AH = 3BH DS:DX = Segment:Offset of ASCIIZ path specification RETURNS: If successful: Carry Flag = Clear If unsuccessful: Carry Flag = Set AX = Error Code 3 - if path not found$ FUNCTION: 47H GET CURRENT DIRECTORY DESCRIPTION: Returns an ASCIIZ string that specifies the path from the root directory to the current directory, inclusive; returned string does not include the drive or a leading '\'; the call fails if the drive code is invalid. CALL: AH = 47H DL = drive code (0=default, 1=A, etc.) DS:SI = Segment:Offset of a 64 byte buffer to hold the returned string RETURNS: If successful: Carry Flag = Clear Buffer contains the complete path as an ASCIIZ string If unsuccessful: Carry Flag = Set AX = Error Code 0FFH - if drive specification invalid$ FUNCTION: 0DH DISK RESET DESCRIPTION: Flushes all file buffers; that is, it writes the contents of all file buffers to the appropriate file on the disk; does not update directory entries, so all files must be closed to insure their entries are updated. CALL: AH = 0DH RETURNS: Nothing$ FUNCTION: 0EH SET DEFAULT DISK DRIVE DESCRIPTION: Sets a specified drive to be the current, or default, disk drive; returns total number of logical (floppy, hard disk partitions, RAM, etc) drives in the system; this call considers logical drive 0 to be the A drive whereas some other functions consider drive 0 to be the current drive. CALL: AH =0EH DL = drive code (0=A, 1=B, etc.) RETURNS: AL = number of logical drives$ FUNCTION: 19H GET DEFAULT DISK DRIVE DESCRIPTION: Returns the drive code for the current, or default, disk drive; this call considers logical drive 0 to be the A drive whereas some other functions consider drive 0 to be the current drive. CALL: AH = 19H RETURNS: AL = drive code (0=A, 1=B, etc.)$ FUNCTION: 1BH GET ALLOCATION INFORMATION FOR DEFAULT DRIVE DESCRIPTION: Returns selected information about the default drive and a pointer to the identification byte in its File Allocation Table (FAT); can be used to calculate total capacity of the default drive; from the FAT identification byte, it can be determined whether the drive is a floppy or a hard disk. CALL: AH = 1BH RETURNS: AL = number of sectors per cluster on the default drive CX = size, in bytes, of each physical sector on the default DX = total number of clusters on the default drive DS:BX = Segment:Offset of the FAT identification byte SEE ALSO: Function 1CH 36H$ FUNCTION: 1CH GET ALLOCATION INFORMATION FOR SPECIFIED DRIVE DESCRIPTION: Returns selected information about a specified drive and a pointer to the identification byte in its File Allocation Table (FAT); can be used to calculate total capacity of the drive; from the FAT identification byte, it can determined whether the drive is a floppy or a hard disk. CALL: AH = 1CH DL = drive code (0=default, 1=A, etc.) RETURNS: If specified drive is valid AL = number of sectors per cluster on the drive CX = size, in bytes, of each physical sector on the drive DX = total number of clusters on the drive DS:BX = Segment:Offset of the FAT identification byte If specified drive is invalid AL = 0FFH SEE ALSO: Function 1BH 36H$ FUNCTION: 2EH SET VERIFY FLAG DESCRIPTION: Programs DOS to automatically verify each disk write; verification entails checking that each written byte can be read, not that it is the same as the source; verification slows down the writing process, so it should be used only for critical data. CALL: AH = 2EH AL = 00 if toggling verification off AL = 01 if toggling verification on RETURNS: Nothing SEE ALSO: Function 54H$ FUNCTION: 36H GET FREE DISK SPACE DESCRIPTION: Returns selected information about a specified disk drive from which the free space and capacity of the disk can be calculated; supercedes functions 1BH and 1CH. CALL: AH = 36H DL = drive code (0=default, 1=A, etc.) RETURNS: If valid drive code AX = sectors per cluster BX = number of free clusters CX = bytes per sector DX = total number of clusters on drive If drive code is invalid AX = 0FFFFH SEE ALSO: Functions 1BH 1CH$ FUNCTION: 54H GET VERIFY FLAG DESCRIPTION: Returns the current value of the verify flag. CALL: AH = 54H RETURNS: AL = Current value of verify flag 00 if verify on 01 if verify is off SEE ALSO: Function 2EH$ FUNCTION: 1AH SET DISK TRANSFER ADDRESS DESCRIPTION: Specifies the memory address to be used for disk operations where an FCB is specified; the default DTA is offset 80H within the program segment prefix (PSP); the memory set aside for the DTA must be sufficiently large to handle the required disk operations; this function must also be used prior to calling the directory functions 11H, 12H 4EH and 4FH. CALL: AH = 1AH DS:DX = Segment:Offset of DTA RETURNS: Nothing SEE ALSO: Function 2FH$ FUNCTION: 2FH GET DISK TRANSFER ADDRESS DESCRIPTION: Returns the address of the current disk transfer area for disk operations using an FCB. CALL: AH = 2FH RETURNS: ES:BX = Segment:Offset of current DTA SEE ALSO: Function 1AH$ FUNCTION: 48H ALLOCATE MEMORY DESCRIPTION: Tries to allocate a specified amount of memory and returns a pointer to the beginning of the allocated block (offset 0); if insufficient memory is available, DOS returns the amount available; when a .COM file is loaded all available memory is automatically allocated to it, so any call to this function will fail; CALL: AH = 48H BX = number of paragraphs (16 bytes) of memory needed RETURNS: If successful Carry Flag = Clear AX = segment of allocated block If unsuccessful Carry Flag = Set AX = Error Code 7 if memory control blocks destroyed 8 if insufficient memory BX = size (paragraphs) of largest block available$ FUNCTION: 49H RELEASE MEMORY DESCRIPTION: Release a block of memory previously allocated by function 48H; the function will fail if the specified address does not belong to the program releasing it or if the specified segment was not allocated by function 48H. CALL: AH = 49H ES = segment of block to be released RETURNS: If successful Carry Flag = Clear If unsuccessful Carry Flag = Set AX = Error Code 7 if memory control blocks destroyed 9 if incorrect segment in ES$ FUNCTION: 4AH MODIFY MEMORY ALLOCATION (SET BLOCK) DESCRIPTION: Changes the size of a memory block previously allocated by function 48H; most commonly used to reduce the size of a .COM program after loading. CALL: AH = 4AH BX = new block size in paragraphs ( 1 paragraph = 16 bytes) ES = segment of block to be modified RETURNS: If successful Carry Flag = Clear If unsuccessful Carry Flag = Set AX = Error Code 7 if memory control block destroyed 8 if insufficient memory 9 if incorrect segment in ES$ FUNCTION: 58H GET OR SET MEMORY ALLOCATION STRATEGY DESCRIPTION: Returns or changes the current memory allocation strategy used by DOS; strategies are: 1. First Fit - DOS searches from low addresses to high, allocating first block large enough to satisfy the request (default); 2. Best Fit - searches all memory to find the smallest block that satisfies the request; 3. Last Fit - DOS searches from high addresses to low, allocating the first block large enough to satisfy the request. CALL: If getting strategy code AH = 58H AL = 00 If setting strategy code AH = 58H AL = 1 BX = strategy code 00 if first fit, 01 if best fit, 02 if last fit RETURNS: If successful Carry Flag = Clear If unsuccessful Carry Flag = Set AX = Error Code 1 invalid function code in AL or BX$ FUNCTION: 0FH OPEN FILE - FCB DESCRIPTION: Opens a file and makes it available for read/write operations; prior to any actual operations, the FCB must be adjusted to reflect any changes from the default (record size); depending on the type of operation, random or sequential, the proper record field in the FCB must also be set; essentially superceded by function 3DH CALL: AH = 0FH DS:DX = Segment:Offset of unopened FCB RETURNS: If successful AX = 0 FCB filled with specified drive, current block, record size, file size, date, and time. If unsuccessful AL = 0FFH SEE ALSO: Function 3DH$ FUNCTION: 10H CLOSE FILE - FCB DESCRIPTION: Closes a file and updates the directory entries if its been modified; essentially superceded by function 3EH. CALL: AH = 10H DS:DX = Segment:Offset of corresponding FCB RETURNS: AL = 0 if directory update successful = 0FFH if directory entry not found SEE ALSO: Function 3EH$ FUNCTION: 11H SEARCH FOR FIRST MATCH - FCB DESCRIPTION: Searches the current directory on the designated disk drive for a matching filename; use function 1AH to set the DTA to a properly sized buffer; use of wild card(s) '?' permitted in filename; an extended FCB must be used to search for files with anything but a normal attribute (system, read only, hidden, etc.); essentially superceded by function 4EH. CALL: AH = 11H DS:DX = Segment:Offset of corresponding FCB RETURNS: If successful (match found) AL = 0 Buffer at current DTA set up as unopened FCB If unsuccessful (no match found) AL = 0FFH SEE ALSO: Function 4EH$ FUNCTION: 12H SEARCH FOR NEXT MATCH - FCB DESCRIPTION: After a prior successful call to function 11H or 12H, returns the next matching filename, if any; essentially superceded by function 4FH. CALL: AH = 12H DS:DX = Segment:Offset of corresponding FCB RETURNS: If successful (another match found) AL = 0 Buffer at current DTA set up as unopened FCB If unsuccessful (no more matches found) AL = 0FFH SEE ALSO: Function 4FH$ FUNCTION: 13H DELETE FILE - FCB DESCRIPTION: Delete all matching files from the current subdirectory; use of wild card(s) '?' permitted in filename; if more than 1 match found, all are deleted; essentially superceded by function 41H. CALL: AH = 13H DS:DX = Segment:Offset of corresponding FCB RETURNS: AL = 0 if file(s) deleted 0FFH if no matching files were found or all matching files were read only. SEE ALSO: Function 41H$ FUNCTION: 16H CREATE OR TRUNCATE FILE - FCB DESCRIPTION: Creates a new file in the current subdirectory or truncates an existing file to zero length (all data is lost); no call to open the file is necessary; essentially superceded by function 3CH. CALL: AH = 16H DS:DX = Segment:Offset of unopened FCB RETURNS: AL = 0 if file created 0FFH if file not created (directory full or no existing file) SEE ALSO: Function 3CH$ FUNCTION: 17H RENAME FILE - FCB DESCRIPTION: Changes the name of an existing file in the current subdirectory; requires the use of a special FCB containing the drive number, current filename and (at offset 11H in the FCB) the new filename; use of wild card(s) '?' permitted in the filenames; if used, the renamed file(s) will maintain the logic governing wild cards; if the new filename matches an existing filename, the function terminates; essentially superceded by function 56H. CALL: AH = 17H DS:DX = Segment:Offset of a special FCB RETURNS: AL = 0 if file(s) renamed 0FFH if no matching file(s) found or a new filename matches an existing one SEE ALSO: Function 56H$ FUNCTION: 23H GET FILE SIZE IN RECORDS - FCB DESCRIPTION: Returns in the FCB the file size, in records, of the specified file; FCB must have the record size filled in before calling this function. CALL: AH = 23H DS:DX = Segment:Offset of unopened FCB RETURNS: If successful AL = 0 FCB's random record field (offset 21H) contains the number of records in the file, rounded up to reflect partial records. If unsuccessful AL = 0FFH$ FUNCTION: 3CH CREATE OR TRUNCATE FILE - ASCIIZ DESCRIPTION: Given an ASCIIZ filespec, creates a new file in the designated or default subdirectory on the designated or default drive or, if the specified file exists, it is opened, but its length is truncated to zero; returns a 16 bit handle to be used for further file operations; function fails if: 1. Some element of path does not exist. 2. If the root directory is specified and it is full. 3. The specified file exists, but has read only attribute. CALL: AH = 3CH CX = file attribute 00 if normal 01 if read only 02 if hidden 03 if system DS:DX = Segment:Offset of ASCIIZ file specification RETURNS: if successful Carry Flag = Clear AX = 16 bit handle if unsuccessful Carry Flag = Set AX = error code 3 - if path not found, 4 - if no handle available 5 - if access denied or directory is full SEE ALSO: Function 43H, 5AH, 5BH$ FUNCTION: 3DH OPEN FILE - ASCIIZ DESCRIPTION: Given an ASCIIZ filespec, creates a new file in the designated or default subdirectory on the designated or default drive; returns a 16 bit handle to be used for further file operations; CALL: AH = 3DH DS:DX = Segment:Offset of ASCIIZ file specification AL = access and (for MS-DOS 3+) file sharing mode (3+)bit 7 = inheritance flag 0 if inherited by child process 1 if for current process only (3+)bits 4-6 = sharing mode 000 if compatability mode 001 if read/write access denied 010 if write access denied 011 if read access denied 100 if full access allowed (3+)bit 3 reserved - should be 0 bits 0-2 = access mode 000 if read access 001 if write access 010 if read/write access ANY KEY FOR MORE - PRIOR MENU TO EXIT@ RETURNS: if successful Carry Flag = Clear AX = 16 bit handle if unsuccessful Carry Flag = Set AX = error code 1 - if invalid function code 2 - if file not found 3 - if path not found, 4 - if no handle available 5 - if access denied 0CH - if file access mode invalid SEE ALSO: Function 43H, 57H$ FUNCTION: 3EH CLOSE FILE - HANDLE DESCRIPTION: Given a handle corresponding to a file opened by a successful function call (3DH, 3CH, 5AH OR 5BH), flushes all DOS buffers to disk, closes the file, releases the handle and if necessary, updates the file's directory entry. CALL: AH = 3EH BX = handle RETURNS: if successful Carry Flag = Clear if unsuccessful Carry Flag = Set AX = error code 0 if invalid handle or not open$ FUNCTION: 41H DELETE FILE - ASCIIZ DESCRIPTION: Deletes a file from a specified or default drive and directory. CALL: AH = 41H DS:DX = Segment:Offset of ASCIIZ file specification RETURNS: if successful Carry Flag = Clear if unsuccessful Carry Flag = Set AX = error code 2 if file not found 3 if access denied$ FUNCTION: 43H GET OR SET FILE ATTRIBUTES - ASCIIZ DESCRIPTION: Gets or sets the attributes of a file; cannot change volume label bit or subdirectory bit. CALL: AH = 43H AL = 00H if get the attribute = 01H if set the attribute CX = new attribute bit 5 - archive bit bit 2 - system bit bit 1 - hidden bit bit 0 - read only bit DS:DX = Segment:Offset of ASCIIZ file specification RETURNS: if successful Carry Flag = Clear CX = attribute if call was to get attribute if unsuccessful Carry Flag = Set AX = error code 1 if invalid function code 2 if file not found 3 if path not found of file does not exist 5 if attribute can't be changed$ FUNCTION: 45H DUPLICATE HANDLE - HANDLE DESCRIPTION: Given a handle for an open file or device, returns a new handle that refers to the same file or device; file pointer moves using one handle results in a change of the file pointer in the other handle; can be used to redirect standard input (handle 0) or standard output (handle 1). CALL: AH = 45H BX = handle RETURNS: if successful Carry Flag = Clear AX = new file handle if unsuccessful Carry Flag = Set AX = error code 4 if no handle available 6 if handle invalid or not open$ FUNCTION: 46H FORCE DUPLICATE OF HANDLE - HANDLE DESCRIPTION: Given two file handles, makes the second handle refer to the same open file at the same location as the first; if second handle already refers to an open file, that file is closed; if file pointer for one handle is changed by a function call, the file pointer for the other is also changed; can be used to redirect standard input (handle 0) or standard output (handle 1). CALL: AH = 46H BX = first handle CX = second handle RETURNS: if successful Carry Flag = Clear if unsuccessful Carry Flag = Set AX = error code 4 if no handle available 6 if handle invalid or not open$ FUNCTION: 4EH SEARCH FOR FIRST MATCH - ASCIIZ DESCRIPTION: Given an ASCIIZ file specification, searches the default or specified directory on the default or specified disk drive for the first matching file; use function 1AH to set the DTA to a properly sized buffer; use of wild card(s) '*' and '?' permitted in filename; if specified attribute is hidden (02H), system (04H) or directory (10H), all normal files are also searched. CALL: AH = 4EH CX = attribute to use in search DS:DX = Segment:Offset of ASCIIZ file specification RETURNS: if successful Carry Flag = Clear DTA filled in as follows bytes 0 - 20 reserved byte 21 attribute of matched file bytes 22 - 23 file time bytes 24 - 25 file date bytes 26 - 27 least significant word of size bytes 28 - 29 most significant word of size bytes 30 - 42 filename and extension in ASCIIZ format ANY KEY FOR MORE - PRIOR MENU TO EXIT@ if unsuccessful Carry Flag = Set AX = error code 2 if path invalid 12H if no matching entry found$ FUNCTION: 4FH SEARCH FOR NEXT MATCH - ASCIIZ DESCRIPTION: Assuming a successful prior call to function 4EH, finds the next matching file in default or specified directory on the default or specified disk drive; DTA must contain information from prior call to function 4EH. CALL: AH = 4FH RETURNS: if successful Carry Flag = Clear DTA filled in as follows bytes 0 - 20 reserved byte 21 attribute of matched file bytes 22 - 23 file time bytes 24 - 25 file date bytes 26 - 27 least significant word of size bytes 28 - 29 most significant word of size bytes 30 - 42 filename and extension in ASCIIZ format if unsuccessful Carry Flag = Set AX = error code 2 if path invalid 12H if no matching entry found$ FUNCTION: 56H RENAME FILE - ASCIIZ DESCRIPTION: Renames a file and/or moves its directory entry to a different directory on the same disk; wild card characters canot be used in either filename; call will fail if: 1. Any element of the path does not exist. 2. The drive for the new file specification is different from the old. 3. The file is being moved to the root directory and it if full. 4. A file already exists with the new path and filename. CALL: AH = 56H DS:DX = Segment:Offset of current ASCIIZ filename ES:DI = Segment:Offset of new ASCIIZ filename RETURNS: if successful Carry Flag = Clear if unsuccessful Carry Flag = Set AX = error code 2 if file ot found 3 if path not found or file doesn't exist 5 if access denied 11H if not the same drive$ FUNCTION: 57H GET OR SET FILE DATE AND TIME - HANDLE DESCRIPTION: Returns or modifies the date and time stamp in a file's directory entry; the file must have been previously opened by a successful function - 3CH, 3DH, 5AH OR 5BH. CALL: if getting date AH = 57H AL = 00 BX = handle if setting date AH = 57H AL = 01 BX = handle CX = time bits 0BH - 0FH = hours (0 through 23) bits 05H - 0AH = minutes (0 through 59) bits 00H - 04H = seconds (# of 2 second increments 0 -29) DX = date bits 09H - 0FH = year (relative to 1980) bits 05H - 08H = month (0 through 12) bits 00H - 04H = day of month (0 through 31) ANY KEY FOR MORE - PRIOR MENU TO EXIT@ RETURNS: if successful Carry Flag = Clear if getting time and date CX = time (same bit map as above) DX = date (same bit map as above) if unsuccessful Carry Flag = Set AX = error code 1 if invalid function code 6 if invalid handle$ FUNCTION: 5AH CREATE TEMPORARY FILE DESCRIPTION: Creates and opens a temporary file with a unique name in a specified directory on the current or specified disk drive; returns the complete file specification of file; file must be deleted by coding in the calling program; function will fail if any element of path does not exist or if file specified path is the root directory, and it is full. CALL: AH = 5AH CX = attribute 00H normal 01H read only 02H hidden 04H system DS:DX = Segment:Offset of ASCIIZ path specification ANY KEY FOR MORE - PRIOR MENU TO EXIT@ RETURNS: if successful Carry Flag = Clear DS:DX = Segment:Offset of complete ASCIIZ file specification if unsuccessful Carry Flag = Set AX = error code 3 if path not found 5 if access denied SEE ALSO: Function 3CH and 5BH$ FUNCTION: 5BH CREATE NEW FILE DESCRIPTION: Given an ASCIIZ filespec, creates a new file in the designated or default subdirectory on the designated or default drive; returns a 16 bit handle to be used for further file operations; function fails if: 1. Some element of path does not exist. 2. If the root directory is specified and it is full. 3. The specified file already exists in the specified directory. CALL: AH = 5BH CX = attribute 00H normal 01H read only 02H hidden 04H system DS:DX = Segment:Offset of complete ASCIIZ file specification RETURNS: if successful Carry Flag = Clear ANY KEY FOR MORE - PRIOR MENU TO EXIT@ if unsuccessful Carry Flag = Set AX = error code 3 if path not found 4 if no handle available 5 if access denied 50H if file already exists SEE ALSO: Function 3CH and 5AH$